package com.wangy.mapper;

import com.wangy.bean.Permission;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author yyzb
 * @date 2024/12/28 20:06
 */
@Mapper
public interface RolePermissionMapper {
    @Delete("delete from role_permission where role_id = #{roleId}")
    void deleteByRoleId(Long roleId);

    @Select("SELECT permission_id FROM role_permission WHERE role_id = #{roleId}")
    List<Long> getPermissionsByRoleId(Long roleId);

    void addRolePermissions(Long roleId, List<Long> permissionIds);
}
